package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 老人请假
 *
 * @author ytche
 * @date 2017年6月20日
 *
 */
@Entity
@Table(name = "tnb_customer_leave")
@JsonApiResource(type = "customerLeave")
public class CustomerLeave extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private Integer createTime; // 创建时间
	private Integer startTime; // 请假时间
	private Integer expectEndTime; // 预计销假日期
	private Integer endTime;// 销假日期
	private Customer customer; // 请假老人
	private String remark;// 描述
	private String reason;// 原因
	private Dicttype leaveReason;// 原因(类别)
	private Integer status;// 请假状态 0已请假1请假中2已完成
	private Integer closeStatus;// 结算状态 0否1是

	@Column(name = "create_time")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name = "start_time")
	public Integer getStartTime() {
		return startTime;
	}

	public void setStartTime(Integer startTime) {
		this.startTime = startTime;
	}

	@Column(name = "expect_end_time")
	public Integer getExpectEndTime() {
		return expectEndTime;
	}

	public void setExpectEndTime(Integer expectEndTime) {
		this.expectEndTime = expectEndTime;
	}

	@Column(name = "end_time")
	public Integer getEndTime() {
		return endTime;
	}

	public void setEndTime(Integer endTime) {
		this.endTime = endTime;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "reason")
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "leave_reason_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getLeaveReason() {
		return leaveReason;
	}

	public void setLeaveReason(Dicttype leaveReason) {
		this.leaveReason = leaveReason;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "close_status")
	public Integer getCloseStatus() {
		return closeStatus;
	}

	public void setCloseStatus(Integer closeStatus) {
		this.closeStatus = closeStatus;
	}
}
